/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function errorFieldSet(fieldSetId, labelId)
{
    var errorLabel = new Ext.form.DisplayField({
        id: labelId,
        hideLabel : true
    })
	
    var errorFieldSet = new Ext.form.FieldSet({
        id: fieldSetId,
        margins: '0 5 5 5',
		
        frame:false,
        //border: false,
	floatable: false,	
        collapsible: true,
        labelAlign: 'top',
        autoHeight:true,
		
        title: '<span class=x-form-item-label-mandatory>Unable to save Record : </span>',
        bodyStyle: 'background-color: #DFE8F6',
		
        items: [errorLabel],
        hidden: true
    });
		
    return errorFieldSet;
}

function showErrorFieldSet(errorArr, regionId, fieldSetId, labelId)
{
    var errorStr = "<span class=x-form-item-label-mandatory>";
    for(var i=0; i< errorArr.length; i++)
    {
        errorStr += errorArr[i] + "<br />";
    }
    errorStr += "</span>";

    Ext.ComponentMgr.get(labelId).setValue(errorStr);
    Ext.ComponentMgr.get(fieldSetId).expand();
    Ext.ComponentMgr.get(fieldSetId).show();
    Ext.ComponentMgr.get(regionId).doLayout();
}

function hideErrorFieldSet(regionId, fieldSetId)
{
    Ext.ComponentMgr.get(fieldSetId).hide(); // Error FieldSet 
    Ext.ComponentMgr.get(regionId).doLayout();
}